package com.ch.movie.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.ch.movie.R
import com.ch.movie.bean.Item


class MovieAdapter(private val mListData: List<Item>) :
    RecyclerView.Adapter<NormalViewHolder>() {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NormalViewHolder {
        val itemView =
            LayoutInflater.from(parent.context).inflate(R.layout.item_movie_layout, parent, false);
        return NormalViewHolder(parent.context, itemView)
    }

    override fun onBindViewHolder(holder: NormalViewHolder, position: Int) {
        holder.onBind(mListData[position].title, mListData[position].path,mListData[position].cover)
    }

    override fun getItemCount(): Int {
        return mListData.size
    }

}
